package com.glsc.ngateway.oaflow.service;

import com.glsc.ngateway.common.api.oaflow.dto.OaDepartmentDto;
import com.glsc.ngateway.common.base.domain.oracle.ecology.Hrmdepartment;
import com.glsc.ngateway.common.base.domain.oracle.ecology.OaUserEmployInfo;
import com.glsc.ngateway.common.base.repo.oracle.ecology.HrmdepartmentRepository;
import com.glsc.ngateway.common.base.repo.oracle.ecology.OaUserRepository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

@Deprecated
@Service
public class OaUserService {


    @Resource
    private OaUserRepository oaUserRepository;

    @Resource
    private HrmdepartmentRepository hrmdepartmentRepository;
    public List<OaUserEmployInfo> getOaUserList(List<String> statusList) {
        return oaUserRepository.findAllByStatusList(statusList);
    }

    public List<OaDepartmentDto> getDepartmentInfoList(List<Integer> oaDepartmentIdList) {
        List<Hrmdepartment> list = hrmdepartmentRepository.findAllByIdList(oaDepartmentIdList);
        List<OaDepartmentDto> resList = list.stream().map(dto->{
            OaDepartmentDto res =new OaDepartmentDto();
            res.setDepartmentId(String.valueOf(dto.isId()));
            res.setDepartmentName(dto.getDepartmentname());
            return res;
        }).collect(Collectors.toList());
        return resList;
    }
}
